package com.iot.exception;

import com.iot.enums.ResultEnum;

public class BaseException extends RuntimeException{
    private int code;
    private String msg;
    private String detail;
    private Throwable error;

    public BaseException(int code, String message) {
        super(message);
        this.code = code;
    }

    public BaseException(String msg) {
        super(msg);
        this.msg = msg;
        this.code = ResultEnum.FAILURE.getCode();
    }

    public BaseException(String msg, int code, String detail) {
        super(msg);
        this.msg = msg;
        this.code = code;
        this.detail = detail;
    }

    public BaseException(String msg, int code, String detail, Throwable error) {
        super(msg, error);
        this.msg = msg;
        this.code = code;
        this.detail = detail;
        this.error = error;
    }

    public int getCode() {
        return this.code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return this.msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getDetail() {
        return this.detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public Throwable getError() {
        return this.error;
    }

    public void setError(Throwable error) {
        this.error = error;
    }
}
